#include <stdio.h>
#include <stdint.h>

void hex_print(const uint8_t *buffer, size_t size)
{
  int i;

  for(i = 0; i < size; i++) {
    printf("%02x ", (unsigned char)buffer[i]);
  }
  printf("\n");
}

void hex_encode_uint8(uint8_t *src, int offset,
    uint8_t value, void *data)
{
  src[offset] = value;
}
void hex_encode_uint16(uint8_t *src, int offset,
    uint16_t value, void *data)
{
  *(uint16_t *)(src + offset) = value;
}
void hex_encode_uint32(uint8_t *src, int offset,
    uint32_t value, void *data)
{
  *(uint32_t *)(src + offset) = value;
}

